*************************************************************************
***Robustness Checks and Sensitivity Tests for 
***Arndt, C, Jensen, C. and Wenzelburger, G(2020): Voters’ Wrath? Policy change and government popularity - accepted for publication in Governance

*This do-file produces the robustness checks for endogeneity in Table B4 on page 25 in the online appendix


*Annotation: We further inspected whether governments do engage in more legislation on pensions and unemployment insurance if they have become more (un-)popular in the month 
*or quarter before by aggregating our dataset and using the number of reforms on both *welfare schemes as dependent variable. Here, we use the first difference in the unemployment rate, 
*GDP growth and lagged government popularity as independent variables. The macro-level regressions are presented in Tables B4 and B5.

use "F:\WSCEP\Governance Paper with PB data\Policy_data_PB_timeseries.dta" , clear


*quarters
gen quarter = month
recode quarter (1 2 3=1) (4 5 6=2) (7 8 9=3) (10 11 12=4)

gen eventquart = yq(year, quarter)
tab eventq
format eventquart %tq
codebook eventq


merge m:m eventquart using "F:\WSCEP\Governance Paper with PB data\GDP_D_q.dta"

merge m:m year month using "F:\WSCEP\Governance Paper with PB data\PB_trend_1977_2013_monthly.dta" , gen(_merge_2)
br



tsset eventdate, monthly


**********************Endogeneity test: Prais-Winsten models of reform activities as function of government support********************************

***pension reforms, numbers (Table B4)

*with lagged government support, lag 1 month, appears in Table B4, M1
prais p_number d1_unemp_month lag1_gdp_q lag1_support_gov_m, rhotype(regress) vce(robust)
outreg2 using "F:\WSCEP\Politbarometer kumuliert for WSECP\endog_testp", alpha(0.001, 0.01, 0.05, 0.1) symbol(***, **, *, +) dec(3) e(ll df_m chi2) word replace

*with lagged government support, lag 3 months, appears in Table B4, M2
prais p_number d1_unemp_month lag1_gdp_q lag4_support_gov_m, rhotype(regress) vce(robust)
outreg2 using "F:\WSCEP\Politbarometer kumuliert for WSECP\endog_testp", alpha(0.001, 0.01, 0.05, 0.1) symbol(***, **, *, +) dec(3) e(ll df_m chi2) word append

*with ∆ in government support one month before, appears in Table B4, M3
prais p_number d1_unemp_month lag1_gdp_q ld1_support_gov_m, rhotype(regress) vce(robust)
outreg2 using "F:\WSCEP\Politbarometer kumuliert for WSECP\endog_testp", alpha(0.001, 0.01, 0.05, 0.1) symbol(***, **, *, +) dec(3) e(ll df_m chi2) word append

*∆ in government support three months before appears in Table B4, M4
prais p_number d1_unemp_month lag1_gdp_q ld4_support_gov_m, rhotype(regress) vce(robust)
outreg2 using "F:\WSCEP\Politbarometer kumuliert for WSECP\endog_testp", alpha(0.001, 0.01, 0.05, 0.1) symbol(***, **, *, +) dec(3) e(ll df_m chi2) word append


***pension reforms, direction (different specification of reform variables, not shown)
prais p_sumdir d1_unemp_month lag1_gdp_q lag1_support_gov_m, rhotype(regress) vce(robust)
outreg2 using "F:\WSCEP\Politbarometer kumuliert for WSECP\endog_testpdir", alpha(0.001, 0.01, 0.05, 0.1) symbol(***, **, *, +) dec(3) e(ll df_m chi2) word replace

prais p_sumdir d1_unemp_month lag1_gdp_q lag4_support_gov_m, rhotype(regress) vce(robust)
outreg2 using "F:\WSCEP\Politbarometer kumuliert for WSECP\endog_testpdir", alpha(0.001, 0.01, 0.05, 0.1) symbol(***, **, *, +) dec(3) e(ll df_m chi2) word append

prais p_sumdir d1_unemp_month lag1_gdp_q ld1_support_gov_m, rhotype(regress) vce(robust)
outreg2 using "F:\WSCEP\Politbarometer kumuliert for WSECP\endog_testpdir", alpha(0.001, 0.01, 0.05, 0.1) symbol(***, **, *, +) dec(3) e(ll df_m chi2) word append

prais p_sumdir d1_unemp_month lag1_gdp_q ld4_support_gov_m, rhotype(regress) vce(robust)
outreg2 using "F:\WSCEP\Politbarometer kumuliert for WSECP\endog_testpdir", alpha(0.001, 0.01, 0.05, 0.1) symbol(***, **, *, +) dec(3) e(ll df_m chi2) word append




***unemployment insurance, numbers (Table B5)

*with lagged government support, lag 1 month, appears in Table B5, M1
prais ub_number d1_unemp_month lag1_gdp_q lag1_support_gov_m, rhotype(regress) vce(robust)
outreg2 using "F:\WSCEP\Politbarometer kumuliert for WSECP\endog_testub", alpha(0.001, 0.01, 0.05, 0.1) symbol(***, **, *, +) dec(3) e(ll df_m chi2) word replace

*with lagged government support, lag 3 month, appears in Table B5, M2
prais ub_number d1_unemp_month lag1_gdp_q lag4_support_gov_m, rhotype(regress) vce(robust)
outreg2 using "F:\WSCEP\Politbarometer kumuliert for WSECP\endog_testub", alpha(0.001, 0.01, 0.05, 0.1) symbol(***, **, *, +) dec(3) e(ll df_m chi2) word append

*with ∆ in government support one month before, appears in Table B5, M3
prais ub_number d1_unemp_month lag1_gdp_q ld1_support_gov_m, rhotype(regress) vce(robust)
outreg2 using "F:\WSCEP\Politbarometer kumuliert for WSECP\endog_testub", alpha(0.001, 0.01, 0.05, 0.1) symbol(***, **, *, +) dec(3) e(ll df_m chi2) word append

*with ∆ in government support three months before, appears in Table B5, M4
prais ub_number d1_unemp_month lag1_gdp_q ld4_support_gov_m, rhotype(regress) vce(robust)
outreg2 using "F:\WSCEP\Politbarometer kumuliert for WSECP\endog_testub", alpha(0.001, 0.01, 0.05, 0.1) symbol(***, **, *, +) dec(3) e(ll df_m chi2) word append


*unemployment insurance, direction (different specification of reform variables, not shown)
prais ub_sumdir d1_unemp_month lag1_gdp_q lag1_support_gov_m, rhotype(regress) vce(robust)
outreg2 using "F:\WSCEP\Politbarometer kumuliert for WSECP\endog_testubdir", alpha(0.001, 0.01, 0.05, 0.1) symbol(***, **, *, +) dec(3) e(ll df_m chi2) word replace

prais ub_sumdir d1_unemp_month lag1_gdp_q lag4_support_gov_m, rhotype(regress) vce(robust)
outreg2 using "F:\WSCEP\Politbarometer kumuliert for WSECP\endog_testubdir", alpha(0.001, 0.01, 0.05, 0.1) symbol(***, **, *, +) dec(3) e(ll df_m chi2) word append

prais ub_sumdir d1_unemp_month lag1_gdp_q ld1_support_gov_m, rhotype(regress) vce(robust)
outreg2 using "F:\WSCEP\Politbarometer kumuliert for WSECP\endog_testubdir", alpha(0.001, 0.01, 0.05, 0.1) symbol(***, **, *, +) dec(3) e(ll df_m chi2) word append

prais ub_sumdir d1_unemp_month lag1_gdp_q ld4_support_gov_m, rhotype(regress) vce(robust)
outreg2 using "F:\WSCEP\Politbarometer kumuliert for WSECP\endog_testubdir", alpha(0.001, 0.01, 0.05, 0.1) symbol(***, **, *, +) dec(3) e(ll df_m chi2) word append
